#!/usr/bin/env python
# _*_ coding: UTF-8 _*_
"""使用skimage模块读取图片，不改变图片数据类型uint16，保存为uint8类型"""
import os
import cv2
import natsort
import numpy as np
from skimage import io
from matplotlib import pylab as plt
input_file = "/home/lx/data/OBDimages/3_json/"  #文件路径
img_type = ".png"
file_name ='label'
full_name = os.path.join(input_file + "label" + img_type)
img = io.imread(full_name)
print(img.dtype)
img = img.astype(np.uint8)
print(img.dtype)
cv2.imwrite(os.path.join(input_file + "label_1" + img_type),img)